package cn.apthink.controller.test;

import org.apache.commons.lang3.StringUtils;
import org.noear.solon.annotation.After;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;

import cn.apthink.solon.Logging;
import cn.apthink.solon.LoggingFilter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;

/**
 * 服务测试
 * @author David唐
 * @createdate 2024年1月18日
 */
@Slf4j
@Controller
@Api("测试控制器")
@Mapping("/test")
public class HelloController {

	@Logging
	@Mapping("/hello")
    @ApiOperation("经典HelloWorld响应")
    public String hello() {
    	log.debug("Hello World!");
		return String.format("Hello World!");
    }

	
	@Logging
    @Mapping("/hi")
    @ApiOperation("hi问候")
    public String hi(@ApiParam(name="name", value="访问者", required=true, defaultValue="Anonymous" ) String name) {
    	String result = StringUtils.isEmpty(name)||StringUtils.isBlank(name)?"Anonymous":name;
    	result = String.format("Hi %s!", result);
    	log.debug(result);
    	return result;
    }

}